/*  1:   */ package org.intellij.plugins.relaxNG.model.resolve;
/*  2:   */ 
/*  3:   */

import com.intellij.psi.xml.XmlFile;
import com.intellij.util.xml.DomFileElement;
import com.intellij.util.xml.DomManager;
import org.intellij.plugins.relaxNG.compact.psi.RncFile;
import org.intellij.plugins.relaxNG.model.Grammar;
import org.intellij.plugins.relaxNG.xml.dom.RngGrammar;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */ 
/* 12:   */ public class GrammarFactory
/* 13:   */ {
/* 14:   */   @Nullable
/* 15:   */   public static Grammar getGrammar(@NotNull XmlFile paramXmlFile)
/* 16:   */   {
/* 17:36 */     if (paramXmlFile == null) {
/* 18:36 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/intellij/plugins/relaxNG/model/resolve/GrammarFactory", "getGrammar" }));
/* 19:   */     }
/* 20:36 */     if ((paramXmlFile instanceof RncFile)) {
/* 21:37 */       return ((RncFile)paramXmlFile).getGrammar();
/* 22:   */     }
/* 23:39 */     DomFileElement localDomFileElement = DomManager.getDomManager(paramXmlFile.getProject()).getFileElement(paramXmlFile, RngGrammar.class);
/* 24:40 */     return localDomFileElement != null ? (RngGrammar)localDomFileElement.getRootElement() : null;
/* 25:   */   }
/* 26:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.plugins.relaxNG.model.resolve.GrammarFactory

 * JD-Core Version:    0.7.0.1

 */